//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//

//
#ifndef Green_RegisterGPGPU_H
#define Green_RegisterGPGPU_H

#include "Register.h"

namespace Green {

  /*!
    \class RegisterFileGPGPU
    \brief Class inheriting RegisterFile, with GPGPU specific architectural details.
  */
  class RegisterFileGPGPU : public RegisterFile
  {
  public:
    Object * Clone() const override;            //!< Return a fully cloned RegisterFileGPGPU object .
    const char* Type() const override { return "RegisterFileGPGPU"; }    //!< Return the type of RegisterFileGPGPU object in string format.

    RegisterFileGPGPU();  //!< Constructor
    ~RegisterFileGPGPU(); //!< Destructor

    Register* GetContainingRegister(const Register* pReg) const override; //!< Return an GPGPU register that contains the passed register object, if applicable.
    bool InitContainingRegister(Register* rContainingReg, const Register* pReg) const override; //!< initialize container reg from the reg it contains

    bool AllowReExecutionInit(const std::string& rRegName) const override; //!< Check if a register is allowed to be initialized in re-execution.
    void SetupRegisterReserver() override;  //!< set up register reserver.
    Register* RegisterLookupByIndex(uint32 index, const ERegisterType reg_type, uint32 size) const override; //!< GPGPU layer register lookup by index method.
    uint32_t GetWarpLimit() const; //!<GPGPU layaer register,  get the warps limit from register of MSPR 
    bool GetRandomRegistersForAccess(cuint32 number, const ERegisterType regType, const ERegAttrType access, const std::string& rExcludes, std::vector<uint64>& rRegIndices) const override;
  protected:
    RegisterFileGPGPU(const RegisterFileGPGPU& rOther); //!< Copy constructor, protected.
  };

}

#endif
